package cn.cs.service;

import cn.cs.mapper.AdBannerMapper;
import cn.cs.mapper.ProductMapper;
import cn.cs.pojo.AdBanner;
import cn.cs.pojo.AgentShop;
import cn.cs.pojo.Product;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class ProductService {

    @Resource
    private ProductMapper productMapper;

    @RequestMapping(value = "/getProductListPageByMap", method = RequestMethod.POST)
    public List<Product> getProductListPageByMap(@RequestBody Map<String,Object> param)throws Exception{
        return productMapper.getProductListPageByMap(param);
    }

    @RequestMapping(value = "/getProductCountByMap", method = RequestMethod.POST)
    public Integer getProductCountByMap(@RequestBody Map<String,Object> param)throws Exception{
        return productMapper.getProductCountByMap(param);
    }


    @RequestMapping(value = "/getPlatFromProImages", method = RequestMethod.POST)
    public  List<String> getPlatFromProImages(@RequestParam("proId") String proId){
        return productMapper.getPlatFromProImages(proId);
    }
    @RequestMapping(value = "/getProductById", method = RequestMethod.POST)
    public Product getProductById(@RequestParam("proId")String proId){
        return productMapper.getProductById(proId);
    }
    @RequestMapping(value = "/getCellCount", method = RequestMethod.POST)
    public int getCellCount(@RequestParam("proId")String proId){
        return productMapper.getCellCount(proId);
    }
    @RequestMapping(value = "/getProImagesByProId", method = RequestMethod.POST)
    public  List<Map<String,Object>> getProImagesByProId(@RequestParam("id")String id){
        return productMapper.getProImagesByProId(id);
    }
    @RequestMapping(value = "/getProEvaluatesByProId", method = RequestMethod.POST)
    public  List<Map<String,Object>> getProEvaluatesByProId(@RequestParam("id")String id){
        return productMapper.getProEvaluatesByProId(id);
    }
    @RequestMapping(value = "/getShopById", method = RequestMethod.POST)
    public AgentShop getShopById(@RequestParam("shopId")String shopId){
        return productMapper.getShopById(shopId);
    }
    @RequestMapping(value = "/getProductListByMap", method = RequestMethod.POST)
    public List<Product> getProductListByMap(@RequestBody Map<String, Object> param){
        return productMapper.getProductListByMap(param);
    }


}
